package decotor

// 咖啡接口
type Coffee interface {
	GetDescription() string
	GetCost() float64
}

// 基础咖啡类
type BaseCoffee struct{}

func (b *BaseCoffee) GetDescription() string {
	return "Base Coffee"
}
func (b *BaseCoffee) GetCost() float64 {
	return 5.0
}

// 加牛奶
type MilkCoffee struct {
	coffee Coffee
}

func NewMilkCoffee(coffee Coffee) *MilkCoffee {
	return &MilkCoffee{coffee: coffee}
}
func (m *MilkCoffee) GetDescription() string {
	return m.coffee.GetDescription() + ", 加牛奶"
}
func (m *MilkCoffee) GetCost() float64 {
	return m.coffee.GetCost() + 2.0
}

// 加糖
type SugarCoffee struct {
	coffee Coffee
}

func NewSugarCoffee(coffee Coffee) *SugarCoffee {
	return &SugarCoffee{coffee: coffee}
}
func (m *SugarCoffee) GetDescription() string {
	return m.coffee.GetDescription() + ", 加糖"
}
func (m *SugarCoffee) GetCost() float64 {
	return m.coffee.GetCost() + 1.0
}
